package com.aspose.cells;

import java.util.ArrayList;

class zqo {
   int a = -1;
   boolean b = false;
   boolean c = true;
   boolean d = true;
   boolean e = true;
   private boolean l = false;
   private boolean m = false;
   private int n = 9;
   private int o = 7;
   zoo f = null;
   boolean g = false;
   ArrayList h = null;
   int i = 1;
   String j = null;
   String k = null;
   private zdx p;

   boolean a() {
      return this.l;
   }

   void a(boolean var1) {
      this.l = var1;
   }

   boolean b() {
      return this.m;
   }

   void b(boolean var1) {
      this.m = var1;
   }

   public int c() {
      return this.n;
   }

   public int d() {
      return this.o;
   }

   public void a(int var1) {
      this.o = var1;
      this.d = false;
   }

   void a(zik var1, Chart var2) {
      this.k = var1.h();
      boolean var3 = false;
      boolean[] var4 = new boolean[]{var3};
      ArrayList var5 = var1.a(false, var2.f(), var4);
      var3 = var4[0];
      if (!var3 && var5 != null && var5.size() != 0) {
         String var6 = "";

         for(int var7 = 0; var7 < var5.size(); ++var7) {
            zit var8 = (zit)var5.get(var7);
            var6 = var6 + this.a(var8, var2.j().n());
            if (var7 != var5.size() - 1) {
               var6 = var6 + " ";
            }
         }

         this.a(var6);
      }

   }

   private String a(zit var1, Workbook var2) {
      switch(var1.g) {
      case 1:
         if (var1.a != null && !"".equals(var1.a())) {
            double var3 = 0.0D;

            try {
               var3 = (Double)var1.a;
            } catch (Exception var8) {
               return var1.a();
            }

            String var5 = null;
            var5 = var1.c;
            if ((var5 == null || "".equals(var5)) && var1.b != 0) {
               var5 = var2.getSettings().e().d(var1.b);
            }

            DateTime var6 = CellsHelper.getDateTimeFromDouble(var3, var2.getSettings().getDate1904());
            if (var5 != null && "".equals(var5)) {
               var5 = null;
            }

            zxz var7 = var2.getSettings().e().a(var5, var6, false);
            return var7.h();
         }

         return var1.a();
      default:
         if (var1.a != null && !"".equals(var1.a())) {
            String var9 = null;
            var9 = var1.c;
            if ((var9 == null || "".equals(var9)) && var1.b != 0) {
               var9 = var2.getSettings().e().d(var1.b);
            }

            if (var9 != null && "".equals(var9)) {
               var9 = null;
            }

            zxz var4 = var2.getSettings().e().a(var9, var1.a, false);
            return var4.h();
         } else {
            return var1.a();
         }
      }
   }

   void a(String var1) {
      if (var1 != null) {
         zqg var2 = new zqg();
         var2.b = var1;
         this.h = new ArrayList();
         com.aspose.cells.b.a.a.ze.a(this.h, (Object)var2);
      }
   }

   zdx e() {
      if (this.p == null) {
         this.p = new zdx();
      }

      return this.p;
   }

   zdx f() {
      return this.p;
   }

   void a(Chart var1, boolean var2) {
      if (var1 != null) {
         zoo var3 = var1.a.g;
         if (var3 != null) {
            double var4 = var2 ? 1.2D : 1.0D;
            this.f.a(var3, var4);
         }
      }
   }

   void a(zoo var1, Title var2, WorksheetCollection var3, boolean var4) {
      if (this.f == null) {
         this.f = var1;
      } else if (this.f != null) {
         this.a(var2.getChart(), var4);
      }

      if (this.a != -1) {
         var2.setRotationAngle(this.a);
      }

      if (!this.c) {
         var2.setTextVerticalAlignment(this.c());
      }

      if (!this.d) {
         var2.setTextHorizontalAlignment(this.d());
      }

      if (this.h != null && this.h.size() > 0) {
         if (this.h.size() == 1) {
            zqg var5 = (zqg)this.h.get(0);
            zoo var6 = var5.a;
            if (var6 == null) {
               var6 = this.f;
            } else {
               var6.a(this.f, 1.0D);
            }

            Font var7 = var2.getFont();
            if (var6 != null) {
               var6.b(var7);
            }

            var2.b(var5.b);
         } else {
            var2.a(new ArrayList());
            StringBuilder var13 = new StringBuilder();
            int var14 = 0;

            for(int var15 = 0; var15 < this.h.size(); ++var15) {
               zqg var8 = (zqg)this.h.get(var15);
               if (var8.b != null) {
                  int var9 = var8.b.length();
                  FontSetting var10 = new FontSetting(var14, var9, var3, true);
                  zoo var11 = var8.a;
                  if (var11 == null) {
                     var11 = this.f;
                  } else {
                     var8.a.a(this.f, 1.0D);
                  }

                  Font var12 = new Font(var3, (Object)null, true);
                  Title.a(var2.getChart(), var12, var4);
                  if (var11 != null) {
                     var11.a(var12);
                  }

                  var10.a(var12);
                  var14 += var9;
                  var13.append(var8.b);
                  com.aspose.cells.b.a.a.ze.a(var2.D(), (Object)var10);
               }
            }

            var2.b(com.aspose.cells.b.a.zr.a(var13));
         }
      }

      if (this.k != null) {
         var2.c(this.k);
      }

      var2.l(this.a());
      var2.m(this.b());
      var2.setTextDirection(this.i);
   }

   void a(Title var1, WorksheetCollection var2, boolean var3) {
      if (this.f == null) {
         this.f = new zoo();
      }

      this.a(var1.getChart(), var3);
      if (var3 && !this.f.b.a(2048L)) {
         this.f.f(360);
      }

      if (!this.f.b.a(2L)) {
         this.f.b(true);
      }

      if (var1.g() != null) {
         this.f.a(var1.getFont());
      } else {
         var1.c(zase.a(this.f, var2));
      }

      if (this.a != -1) {
         var1.setRotationAngle(this.a);
      }

      if (!this.c) {
         var1.setTextVerticalAlignment(this.c());
      }

      if (!this.d) {
         var1.setTextHorizontalAlignment(this.d());
      }

      if (this.h != null && this.h.size() > 0) {
         if (this.h.size() == 1) {
            zqg var4 = (zqg)this.h.get(0);
            zoo var5 = var4.a;
            if (var5 == null) {
               var5 = this.f;
            }

            if (var5 != null) {
               var5.a(var1.getFont());
            }

            var1.b(var4.b);
         } else {
            var1.a(new ArrayList());
            StringBuilder var11 = new StringBuilder();
            int var12 = 0;

            for(int var6 = 0; var6 < this.h.size(); ++var6) {
               zqg var7 = (zqg)this.h.get(var6);
               if (var7.b != null) {
                  int var8 = var7.b.length();
                  FontSetting var9 = new FontSetting(var12, var8, var2, true);
                  if (var7.a != null) {
                     var7.a.a(this.f, 1.0D);
                     Font var10 = new Font(var2, (Object)null, true);
                     var7.a.a(var10);
                     var9.a(var10);
                  } else {
                     this.f.a(var9.getFont());
                  }

                  var12 += var8;
                  var11.append(var7.b);
                  com.aspose.cells.b.a.a.ze.a(var1.D(), (Object)var9);
               }
            }

            var1.b(com.aspose.cells.b.a.zr.a(var11));
         }
      }

      if (this.k != null) {
         var1.c(this.k);
      }

      var1.l(this.a());
      var1.m(this.b());
      var1.setTextDirection(this.i);
   }

   void a(DataLabels var1, WorksheetCollection var2) {
      if (this.k != null && !"".equals(this.k)) {
         var1.b(this.k);
      }

      zqg var3;
      zoo var4;
      int var5;
      zqg var6;
      int var7;
      FontSetting var8;
      Font var9;
      StringBuilder var10;
      int var11;
      if (this.f == null) {
         if (var1.L() != null && var1.L() instanceof ChartPoint) {
            if (this.h != null) {
               if (this.h.size() == 1) {
                  var3 = (zqg)this.h.get(0);
                  if (var3.b != null) {
                     var1.a(var3.b);
                     var1.setAutoText(false);
                     var4 = var3.a;
                     if (var4 == null) {
                        var4 = new zoo();
                     }

                     if (var4 != null) {
                        if (var1.g() != null) {
                           var4.a(var1.getFont());
                        } else {
                           var1.c(zase.a(var4, var2));
                        }
                     }
                  }
               } else {
                  var1.a(new ArrayList());
                  var10 = new StringBuilder();
                  var11 = 0;

                  for(var5 = 0; var5 < this.h.size(); ++var5) {
                     var6 = (zqg)this.h.get(var5);
                     if (var6.b != null) {
                        var7 = var6.b.length();
                        var8 = new FontSetting(var11, var7, var2, true);
                        if (var6.a != null) {
                           var9 = new Font(var2, (Object)null, true);
                           var6.a.a(var9);
                           var8.a(var9);
                        }

                        var11 += var7;
                        var10.append(var6.b);
                        com.aspose.cells.b.a.a.ze.a(var1.a(), (Object)var8);
                     }
                  }

                  if (var10.length() > 0) {
                     var1.setAutoText(false);
                  }

                  var1.a(com.aspose.cells.b.a.zr.a(var10));
               }
            }

            return;
         }

         this.f = new zoo();
      }

      this.a(var1.getChart(), false);
      if (this.a != -1) {
         var1.setRotationAngle(this.a);
      }

      if (!this.c) {
         var1.setTextVerticalAlignment(this.c());
      }

      if (!this.d) {
         var1.setTextHorizontalAlignment(this.d());
      }

      var1.o = this.e;
      if (this.h == null) {
         if (var1.g() != null) {
            this.f.a(var1.getFont());
         } else {
            var1.c(zase.a(this.f, var2));
         }
      } else if (this.h.size() == 1) {
         var3 = (zqg)this.h.get(0);
         if (var3.b != null) {
            var1.a(var3.b);
            var4 = var3.a;
            if (var3.a == null) {
               var4 = this.f;
            }

            if (var4 != null) {
               if (var1.g() != null) {
                  var4.a(var1.getFont());
               } else {
                  var1.c(zase.a(var4, var2));
               }
            }
         }
      } else {
         if (var1.g() != null) {
            this.f.a(var1.getFont());
         } else {
            var1.c(zase.a(this.f, var2));
         }

         var1.a(new ArrayList());
         var10 = new StringBuilder();
         var11 = 0;

         for(var5 = 0; var5 < this.h.size(); ++var5) {
            var6 = (zqg)this.h.get(var5);
            if (var6.b != null) {
               var7 = var6.b.length();
               var8 = new FontSetting(var11, var7, var2, true);
               if (var6.a != null) {
                  var6.a.a(this.f, 1.0D);
                  var9 = new Font(var2, (Object)null, true);
                  var6.a.a(var9);
                  var8.a(var9);
               } else {
                  this.f.a(var8.getFont());
               }

               var11 += var7;
               var10.append(var6.b);
               com.aspose.cells.b.a.a.ze.a(var1.a(), (Object)var8);
            }
         }

         var1.setAutoText(false);
         var1.a(com.aspose.cells.b.a.zr.a(var10));
      }

      var1.j(this.a());
      var1.k(this.b());
      var1.setTextDirection(this.i);
   }

   void a(TickLabels var1, Chart var2, WorksheetCollection var3) {
      if (this.a != -1) {
         var1.b(this.a);
      }

      if (this.f != null) {
         this.a(var2, false);
         var1.a(zase.a(this.f, var3));
      }

      var1.b(this.a());
      var1.c(this.b());
      var1.setTextDirection(this.i);
   }

   void a(zbtz var1, WorksheetCollection var2) {
      if (this.f != null) {
         var1.g(zase.a(this.f, var2));
      }

      if (this.h != null) {
         if (var1.p() == null) {
            var1.b(new ArrayList());
         }

         StringBuilder var3 = new StringBuilder();
         int var4 = 0;
         if (var1.i() != null) {
            var4 = var1.i().length();
         }

         for(int var5 = 0; var5 < this.h.size(); ++var5) {
            zqg var6 = (zqg)this.h.get(var5);
            if (var6.b != null) {
               int var7 = var6.b.length();
               FontSetting var8 = new FontSetting(var4, var7, var2, true);
               if (this.c) {
                  var8.a(var1.h());
               } else {
                  var8.a(this.c());
               }

               if (this.d) {
                  var8.b(var1.g());
               } else {
                  var8.b(this.d());
               }

               Font var9 = null;
               if (var6.a != null) {
                  Workbook var10;
                  if (var6.a.j() != null && "+mj-lt".equals(var6.a.j())) {
                     var10 = var2.n();
                     String var13 = var10.c.f.a(var6.a.e(), var6.a.g(), true);
                     if (var13 != null) {
                        var6.a.d(var13);
                     }
                  } else if (var6.a.j() == null && var1.k().a() != null) {
                     var10 = var2.n();
                     boolean var11;
                     String var12;
                     if (var10.getSettings().getRegion() != 0) {
                        var11 = true;
                        if ("minor".equals(var1.k().a().toLowerCase())) {
                           var11 = false;
                        }

                        var12 = var10.c.f.a(var10.getSettings().getRegion(), var11);
                        if (var12 != null) {
                           var6.a.d(var12);
                        }
                     } else {
                        var11 = true;
                        if ("minor".equals(var1.k().a().toLowerCase())) {
                           var11 = false;
                        }

                        var12 = var10.c.f.a(var6.a.e(), var6.a.g(), var11);
                        if (var12 != null) {
                           var6.a.d(var12);
                        }
                     }
                  }

                  if (var6.a.k() != null && var6.a.k().a()) {
                     var6.a.a(var1.k().b);
                  }

                  var6.a.a(this.f, 1.0D);
                  var9 = new Font(var2, (Object)null, true);
                  if (var2.n().k()) {
                     if (zar.a(var6.b)) {
                        var9.c("Arial");
                     } else {
                        var9.c("Calibri");
                     }

                     var9.a(11.0D);
                  } else {
                     var9.c(var9.getName());
                     var9.a(10.0D);
                  }

                  var6.a.a(var9);
                  var8.a(var9);
               } else if (this.f != null) {
                  this.f.a(var8.getFont());
               }

               var4 += var7;
               var3.append(var6.b);
               if (var5 == 0 && this.p != null) {
                  var8.d().a(this.p);
               }

               com.aspose.cells.b.a.a.ze.a(var1.p(), (Object)var8);
               if (this.f == null && var5 == 0 && var9 != null) {
                  var1.c = var9;
               }
            }
         }

         if (var1.i() != null) {
            var1.c(var1.i() + com.aspose.cells.b.a.zr.a(var3));
         } else {
            var1.c(com.aspose.cells.b.a.zr.a(var3));
            if (this.d() != 7) {
               var1.e(this.d());
            }
         }
      }

      if (this.j != null) {
         var1.d().a(1, this.j);
      }

   }

   void a(DisplayUnitLabel var1, WorksheetCollection var2) {
      if (this.k != null) {
         var1.a(this.k);
      }

      if (this.f == null) {
         this.f = new zoo();
      }

      this.a(var1.getChart(), false);
      if (this.a != -1) {
         var1.setRotationAngle(this.a);
      }

      if (!this.c) {
         var1.setTextVerticalAlignment(this.c());
      }

      if (!this.d) {
         var1.setTextHorizontalAlignment(this.d());
      }

      if (this.h == null) {
         if (var1.g() != null) {
            this.f.a(var1.getFont());
         } else {
            var1.c(zase.a(this.f, var2));
         }
      } else {
         zqg var3 = (zqg)this.h.get(0);
         if (var3.b != null) {
            var1.setText(var3.b);
            zoo var4 = var3.a;
            if (var3.a == null) {
               var4 = this.f;
            }

            if (var4 != null) {
               if (var1.g() != null) {
                  var4.a(var1.getFont());
               } else {
                  var1.c(zase.a(var4, var2));
               }
            }
         }
      }

      var1.j(this.a());
      var1.k(this.b());
      var1.setTextDirection(this.i);
   }
}
